import request from '@/request'

const API = {
  ['NEWS_CATEGORY']: '/api/news/categoryList',
  ['NEWS_LIST']: '/api/news/newsList',
  ['NEWS_DETAILS']: '/api/news/newsInfo',
  ['MESSAGE_LIST']: '/api/personal/messageList'
}

/**
 * 获取新闻资讯分类
 */
export const fetchNewsCategory = () => request({ url: API.NEWS_CATEGORY })

/**
 * 获取新闻资讯列表
 */
export const fetchNewsList = data => request({ url: API.NEWS_LIST, data })

/**
 * 获取新闻资讯详情
 * @param {number} id 新闻资讯id
 */
export const fetchNewsDetails = id =>
  request({ url: API.NEWS_DETAILS, data: { id } })

/**
 * 获取通知消息列表
 */
export const fetchMessageList = data => request({ url: API.MESSAGE_LIST, data })
